package dao.impl;

import dao.UserDao;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import pojo.User;
import util.MyBatisUtil;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class UserDaoImpl implements UserDao {
   @Override
    public List<User> findAll()
    {
     return MyBatisUtil.getSession().getMapper(UserDao.class).findAll();
    }
    @Override
    public int addUser(User user)
    {
        SqlSession session= MyBatisUtil.getSession();
        int res=session.getMapper(UserDao.class).addUser(user);
        session.commit();
        return 1;
    }
}
